<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Table {{ table_name }}</title>
</head>
<body>
    <h1>Table: {{ table_name }}</h1>
    {% if create_view_sql %}
        <h3>View Definition:</h3>
        <pre>{{ create_view_sql[0] }}</pre>
    {% endif %}
    <h2>Columns</h2>
    <ul>
        {% for column in columns %}
        <li>{{ column[0] }} ({{ column[1] }})</li>
        {% endfor %}
    </ul>
    <h2>Data</h2>
    <table border="1">
        <tr>
            {% for col in data.columns %}
            <th>{{ col }}</th>
            {% endfor %}
        </tr>
        {% for row in data.itertuples(index=False) %}
        <tr>
            {% for value in row %}
            <td>{{ value }}</td>
            {% endfor %}
        </tr>
        {% endfor %}
    </table>
{#    <a href="{{ url_for('showtables') }}">Back to Tables</a>#}
</body>
</html>
